/**
* 测肤结果自定义分数产品关联列表
* @author Zeon scplay@gmail.com
* @date 2019/3/29
* @copyright Created by Panxsoft.
*/
<style lang="less" rel="stylesheet/less" type="text/less" scoped>

</style>
<template>
	<div class="v-customer-custom-recommend-value-index">
		<!-- :loading="loading" -->
		<Table
			:columns="columns"
			:loading="loading"
			:data="index_data"
			height="580"
			class="personal-scrollbar"

			border

		/>

	</div>
</template>

<script>

import Button from 'iview/src/components/button';

export default {
	name: 'CustomRecommendValueIndex',
	props: {
		loading: {
			type: Boolean,
			default() {
				return false;
			},
		},
		index_data: {
			type: Array,
			dafult() {
				return [];
			},
		},

	},
	data() {
		return {
			columns: [
				{
					title: this.$t('身体部位'),
					key: 'position_name',
					width: 140,
					align: 'center',
					render: (h, { row }) =>

						 (<div>{row.position_name}</div>)
					,
				},
				{
					title: this.$t('检测项目'),
					key: 'item_name',
					align: 'center',
					width: 140,
					render: (h, { row }) => (<div>{row.item_name}</div>),
				},
				{
					title: this.$t('选择程度'),
					key: 'get_stores',
					width: 140,
					align: 'center',
					render: (h, { row }) => (

						<div>{row.level_name}</div>


					),
				},
				{
					title: this.$t('商品个数'),
					key: 'get_device_accounts',

					align: 'center',
					render: (h, { row }) => (<div>{row.products.length}</div>),
				},

				{
					title: this.$t('common.created_at'),
					width: 180,
					key: 'created_at',
					align: 'center',
					render: (h, { row }) => (<div>{row.created_at}</div>),
				},
				{
					title: this.$t('更新时间'),
					width: 180,
					key: 'started_at',
					align: 'center',
					render: (h, { row }) => (<div>{row.updated_at}</div>),
				},

				// 渲染编辑、删除按钮
				{
					title: this.$t('common.operation'),
					align: 'center',
					width: 140,
					render: (h, { row }) => (
						<div>
							<Button name="index__edit" size="small" style={{ marginRight: '5px' }} on-click={() => { this.$emit('edit', row); }} type="primary">
								{ this.$t('common.edit') }
							</Button>
							<Button name="index__delete" size="small" style={{ marginRight: '5px' }} on-click={() => { this.$emit('delete', row.id); }} type="error">
								{ this.$t('common.delete') }
							</Button>
						</div>),
				},
			],
		};
	},
	methods: {
		/**
         * 排序的回调
         * @param  {Object} param {对应列的属性对象,里面包含了column列属性，key值，order排序字段}
         * @return {undefined}
         */
		// sortable(param) {
		// 	const search_param = {
		// 		sort_column: param.key,

		// 		sort_by: param.order === 'normal' ? '' : param.order,
		// 	};

		// 	this.$emit('sort', search_param);
		// },

	},
};
</script>
